package com.wyy.travels.dao;/*
 **
 * @author yangyang
 *@date 2022/07/23 21:29
 **/

import com.wyy.travels.entity.Place;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Mapper
public interface PlaceDao extends  BaseDao<Place,String> {

 @Select("select id,name,picpath,hottime,hotticket,dimticket,placedes,provinceid from t_place where provinceid=#{provinceId} order by hotticket limit #{start},#{rows}")
 List<Place> findByProvinceIdPage(@Param("start") Integer start,@Param("rows") Integer rows,@Param("provinceId") String provinceId);
 @Select("select count(id) from t_place where provinceid=#{provinceId}")
 Integer findByProvinceIdCounts(String provinceId);

 @Delete(" delete from t_place where id = #{id}")
 void  delete(String id);

 @Insert("insert into t_place value(#{id},#{name},#{picpath},#{hottime},#{hotticket},#{dimticket},#{placedes},#{provinceid})")
 @Options(useGeneratedKeys = true,keyColumn = "id",keyProperty = "id")
 void  save(Place place);
  @Select(" select id,name,picpath,hottime,hotticket,dimticket,placedes,provinceid from t_place  where id=#{id}")
  Place findOne(String id);
  @Update("update t_place set   name=#{name},picpath=#{picpath},hottime=#{hottime},  hotticket=#{hotticket}, dimticket=#{dimticket}, placedes=#{placedes}, provinceid=#{provinceid} where id = #{id}")
  void update(Place place);
}
